package ru.spb.nicetu.schoolproject;

import ru.spb.nicetu.schoolproject.data.HibernateTblModel;
import ru.spb.nicetu.schoolproject.data.Teacher;

/**
 * Created by dchernyshov on 01.04.15.
 */
public class TblModelForTeachers extends HibernateTblModel<Teacher> {
    public TblModelForTeachers() {
        super(Teacher.class, 2);
    }

    @Override
    public String getColumnName(int columnIndex) {
        switch (columnIndex) {
            case 0:
                return "ФИО";
            case 1:
                return "Предмет";
            case 2:
                return "Кабинет";
        }
        return "";
    }

    @Override
    public int getColumnCount() {
        return 3;
    }

    @Override
    public Object getValueAt(int i, int i1) {
        Teacher t = list.get(i);
        switch (i1) {
            case 0:
                return t.getTeacherName();
            case 1:
                return t.getSubject().getName().trim();
            case 2:
                return t.getCabinet();
            default:
                return null;
        }
    }
}
